﻿@using CodeCamp.Models.Sessions
@using CodeCamp.Models.Shared
@model SessionsDetailsViewModel
@{
    @* ViewBag.RegistrationUrl set in code - SetSharedViewBagProperties *@
    ViewBag.Title = "";
    if ((@Model != null) && (@Model.EventDisplayName != null))
    {
        ViewBag.Title = (@Model.EventDisplayName + " | Session Details for " + @Model.Title);
    }
    else
    {
        ViewBag.Title = "Code Camp | Session Details for " + @Model.Title;
    }
}

@section headaddon {
<style>
    p.session-description
    {
        margin-top: 8px;
    }
    span.materials-link-note
    {
        color: Fuchsia;
        font-size: 10pt;
    }
</style>
}

<h2>@Model.Title</h2>
<h3 style="margin-bottom:.5em;margin-top:1em;">Session Details - @Model.EventDisplayName - @Model.EventStartDate.ToString("MMMM yyyy")</h3>
@if (Model.IsCurrentUserAuthorizedToEdit && (!string.IsNullOrWhiteSpace(Model.DefaultEmailFromAddress) || !string.IsNullOrWhiteSpace(Model.DefaultPresenterReplyEmailAddress)))
{
    <div style="margin-top:1em;margin-bottom:1em;border:dotted;border-width:1px;">
        <h4>Presenters: Make sure the following email address(es) are in your <b>spam white-list</b>!</h4>
        <h4>@Model.DefaultEmailFromAddress - @Model.DefaultPresenterReplyEmailAddress</h4>
    </div>
}
@if (Model.PresentersArePublic || User.IsInRole(CCRoles.RoleNames.BigCheeze) || User.IsInRole(CCRoles.RoleNames.EventContentEditor)
    || User.IsInRole(CCRoles.RoleNames.EventTrackLead))
{
    if (!Model.PresentersArePublic)
    {
        <b>[presenter(s) not public]</b>
    }
@Html.Partial("PartialViews/SessionPresenters", @Model.SessionPresenters.Presenters)<br />
}

@if ((Model.SessionScheduleInfo != null) && (Model.ScheduleIsPublic || Model.ScheduleInsider))
{ @Html.Partial("PartialViews/SessionScheduleInfo", @Model.SessionScheduleInfo) }

@Html.Partial("PartialViews/SessionTags", @Model.SessionTags)

@if (!string.IsNullOrWhiteSpace(@Model.SessionMaterialsUrl))
{
    bool showLink = false;
    bool publicLink = false;
    if (Model.EventStartDate <= DateTime.Now)
    {
        showLink = true;
        publicLink = true;
    }
    else if (Model.IsCurrentUserAuthorizedToEdit)
    {
        showLink = true;
        publicLink = false;
    }
    if (showLink)
    {
    <p>
        <b>View and/or Download</b> the <a href="@Model.SessionMaterialsUrl">session materials</a>.  (May be link to blog entry or download file.)
        @if (!publicLink)
        {
            <br /><span class="materials-link-note">Link will not be visible to public until start of event.</span>
        }
    </p>
    }
}

@if (@Model.IsCurrentUserAuthorizedToEdit)
{
    <p>
        @Html.ActionLink("Edit", "Edit", new { id = Model.SessionId }, null)
    </p>
}

<p class="session-description">
@Html.Raw(@Html.Encode(Model.Description).Replace(Environment.NewLine, "<br/>"))
</p>

@if (User.IsInRole(CCRoles.RoleNames.BigCheeze)
    || User.IsInRole(CCRoles.RoleNames.Presenter))
{
<div id="editSessionTags" style="background-color: Silver; padding: 10px;">
    <div>
        @using (@Html.BeginForm("DetailsSetTags", "Sessions"))
        {
            @Html.Partial("PartialViews/EditSessionTags",
             new EditSessionTags(Model.AllEventTags) { SessionId = Model.SessionId, SessionTags = Model.SessionTags })
        }
    </div>
    <div>
        @using (@Html.BeginForm("DetailsAddTag", "Sessions"))
        {
            @Html.Partial("PartialViews/AddSessionTag",
             new AddSessionTag() { SessionId = Model.SessionId });
        }
    </div>
    <div>Note: The tag changes you make are visible to everyone.  
    Please be thoughtful about the tag changes you make, especially if you are not the presenter!</div>
</div>
}

@if (User.IsInRole(CCRoles.RoleNames.BigCheeze) && (Model.PrivateInfo != null))
{
    <div>
        <h2>Private Information</h2>
        <h3>Do not share this information in public</h3>
        @if (!string.IsNullOrWhiteSpace(Model.PrivateInfo.PrivateNotes))
        {
            <text>Presenter Private Notes (shared with organizers):<br /></text>
            @Html.TextAreaFor(model => model.PrivateInfo.PrivateNotes, new { cols = 60, rows = 5, @readonly = "true" })<br />
        }
        @if (!string.IsNullOrWhiteSpace(Model.PrivateInfo.OrganizerNotes))
        {
            <text>Organizer Notes (not visible to presenter):<br /></text>
            @Html.TextAreaFor(model => model.PrivateInfo.OrganizerNotes, new { cols = 60, rows = 5, @readonly = "true" })<br />
        }
    </div>
}


@section sidebar {
    @Html.Partial("SidebarCommonPartial")

    <div id="eventTagsContainer" class="widget rounded-10">
        <h3>Event Tags</h3>
        @Html.Partial("PartialViews/EventTags", Model.EventTagsInUse)
    </div>
}
